{% extends "base.html" %}
{% block title %}银行询证函-{{ data.basic.get("被审计单位") }}{% endblock %}

{% block main %}
    <div class="row">
        <button class="btn-xs btn-danger"
                onclick=get_alert("{{ url_for('confirmation.re_mk',co_id=data.id) }}")>重新生成
        </button>
        <button class="btn-xs btn-danger"
                onclick=link("{{ url_for('confirmation.download',co_id=data.id) }}")>批量下载
        </button>
        <button type="button" class="btn-xs btn-primary" data-toggle="modal" data-target="#myModal">
            修改基础资料
        </button>
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">修改基础资料</h4>
                    </div>
                    <div class="modal-body">
                        <form id="change_data">
                            {% for i in data.basic %}
                                <div id={{ i }}><strong>{{ i }}:</strong></div>
                                <input value="{{ data.basic.get(i) }}" name="{{ i }}" style="width: 100%">
                            {% endfor %}
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" data-dismiss="modal"
                                onclick=refresh_submit("{{ url_for('confirmation.change_data',co_id=data.id) }}","change_data")>
                            保存
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <h1>基础资料</h1>
        {% for i in data.basic %}
            <div class="col-xs-6 col-sm-6">
                <div class="col-xs-6 col-sm-3" style="padding: unset;"><strong>{{ i }}:</strong></div>
                <div class="col-xs-6 col-sm-9" style="padding: unset;">{{ data.basic.get(i) }}</div>
            </div>
        {% endfor %}
    </div>
    <div class="row">
        <h1>函证</h1>
        <div class="table-responsive">
            <table class="table table-striped">
                <tbody>
                {% for c in data.data %}
                    <tr>
                        <td>{{ c.bank_name }}</td>

                        <td>
                            <button class="btn-xs btn-primary"
                                    onclick=get_change_button("{{ url_for('confirmation.add_none',co_id=data.id,bank_id=c.no_id) }}",this)>
                                {%- if c.data.add_none -%}是{%- else -%}否{%- endif -%}
                            </button>
                        </td>
                        <td>
                            <button class="btn-xs btn-primary"
                                    onclick=get_change_button("{{ url_for('confirmation.form_two',co_id=data.id,bank_id=c.no_id) }}",this)>
                                {%- if c.data.form_two -%}是{%- else -%}否{%- endif -%}
                            </button>
                        </td>
                        <td>
                            <button type="button" class="btn-xs btn-danger" data-toggle="modal"
                                    data-target="#change_pay_bank_{{ c.no_id }}">
                                修改付款账号
                            </button>
                            <div class="modal fade" id="change_pay_bank_{{ c.no_id }}" tabindex="-1" role="dialog"
                                 aria-labelledby="myModalLabel">
                                <div class="modal-dialog" role="document">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                                    aria-hidden="true">&times;</span></button>
                                            <h4 class="modal-title" id="myModalLabel">{{ c.bank_name }}_修改付款账号</h4>
                                        </div>
                                        <div class="modal-body">
                                            <form id="change_pay_bank_form_{{ c.no_id }}">
                                                <table class="table table-striped">
                                                    <tbody>
                                                    {% for i in c.data.data[0].data %}
                                                        <tr id="1">
                                                            <td>
                                                                <label style="margin-bottom: unset">
                                                                    <input name="select_bank" type="radio"
                                                                           value="{{ i[1] }}">
                                                                </label>
                                                            </td>
                                                            {{ i[1]|confirmation_format(c.data.data[0].titles[1])|safe }}
                                                            {{ i[2]|confirmation_format(c.data.data[0].titles[2])|safe }}
                                                            {{ i[4]|confirmation_format(c.data.data[0].titles[4])|safe }}
                                                            {{ i[5]|confirmation_format(c.data.data[0].titles[5])|safe }}
                                                        </tr>
                                                    {% endfor %}
                                                    <tr>
                                                        <td style="vertical-align: middle">
                                                            <label style="margin-bottom: unset">
                                                                <input name="select_bank" type="radio" value="other">
                                                            </label>
                                                        </td>
                                                        <td>
                                                            <input type="text" placeholder="其他银行账号" name="other_bank"
                                                                   style="border: 0;width: 100%" value="">
                                                        </td>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                    </tr>
                                                    </tbody>
                                                    <thead>
                                                    <tr>
                                                        <th>选择</th>
                                                        <th>账号</th>
                                                        <th>币别</th>
                                                        <th>账户类型</th>
                                                        <th>余额</th>
                                                    </tr>
                                                    </thead>
                                                </table>
                                            </form>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                                            </button>
                                            <button type="button" class="btn btn-primary" data-dismiss="modal"
                                                    onclick=submit_get("{{ url_for('confirmation.set_pay_bank',co_id=data.id,bank_id=c.no_id) }}","change_pay_bank_form_{{ c.no_id }}")>
                                                保存
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <button class="btn-xs btn-danger"
                                    onclick=link("{{ url_for('confirmation.view',co_id=data.id,bank_id=c.no_id) }}")>
                                查看网页
                            </button>
                            <button class="btn-xs btn-danger"
                                    onclick=link("{{ url_for('confirmation.pdf',co_id=data.id,bank_id=c.no_id) }}")>
                                查看pdf
                            </button>
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
                <thead>
                <tr>
                    <th>银行名称</th>
                    <th>空项目添加无</th>
                    <th>使用格式二</th>
                    <th>操作</th>
                </tr>
                </thead>
            </table>
        </div>
    </div>
{% endblock %}